package com.project.projectdemo.utils;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * 签名工具类
 * 具体使用的时候，增加过期校验
 * @author 
 */
public class SignUtils {
	
	
	private static final String prefix = "ESB_";
	private static final String suffix = "_ESB";
	
	/**
	 * 获取加签后的密文
	 * @param sys 时间戳
	 * @return
	 */
	public static String getMD5Sign(String sys){
		try {
			String str = prefix+sys+suffix;
			MessageDigest md = MessageDigest.getInstance("md5");
			md.update(str.getBytes());
			return new BigInteger(1,md.digest()).toString(16).toUpperCase();
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
